<?php
/***************************************************************
*  Copyright notice
*  (c) 2009, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'core.upload.class.php');

class CoreUploader {
	var $uploadObj = NULL;
	
	//constructor
	function CoreUploader($file = '', $destination = '', $permissions = '777', $extensions = '') {
		if( isset($_FILES[$file]) && is_array($_FILES[$file]) ) {
			$this->uploadObj = new CoreMultiUpload($file, $destination, $permissions, $extensions);
		} else {
			$this->uploadObj = new CoreUpload($file, $destination, $permissions, $extensions);
		}
	}
	
	function parse() {
		$this->uploadObj->parse();
	}
	
	function save() {
		$this->uploadObj->save();
	}
	
	function upload() {
		if( ($this->uploadObj->parse() == true) && ($this->uploadObj->save() == true) ) {
			return true;
		} else {
			return false;
		}
	}
	
	function getMessages() {
		return $this->uploadObj->getMessages();
	}
	
	//
	function thumb() {
		
	}
	
	function resize() {
		
	}
}
//
?>